using CommunityToolkit.Mvvm.ComponentModel;

namespace Everywhere.Configuration;

[GeneratedSettingsItems]
public partial class ProxySettings : ObservableObject
{
    [ObservableProperty]
    [DynamicResourceKey(
        LocaleKey.ProxySettings_IsEnabled_Header,
        LocaleKey.ProxySettings_IsEnabled_Description)]
    public partial bool IsEnabled { get; set; }

    [ObservableProperty]
    [DynamicResourceKey(
        LocaleKey.ProxySettings_Endpoint_Header,
        LocaleKey.ProxySettings_Endpoint_Description)]
    [SettingsItem(IsVisibleBindingPath = nameof(IsEnabled))]
    [SettingsStringItem(Watermark = "http://127.0.0.1:7890")]
    public partial Customizable<string> Endpoint { get; set; } = "http://127.0.0.1:7890";

    [ObservableProperty]
    [DynamicResourceKey(
        LocaleKey.ProxySettings_BypassOnLocal_Header,
        LocaleKey.ProxySettings_BypassOnLocal_Description)]
    [SettingsItem(IsVisibleBindingPath = nameof(IsEnabled))]
    public partial bool BypassOnLocal { get; set; } = true;

    [ObservableProperty]
    [DynamicResourceKey(
        LocaleKey.ProxySettings_BypassList_Header,
        LocaleKey.ProxySettings_BypassList_Description)]
    [SettingsItem(IsVisibleBindingPath = nameof(IsEnabled))]
    [SettingsStringItem(Watermark = "www.example.com", IsMultiline = true, Height = 96)]
    public partial string? BypassList { get; set; }

    [ObservableProperty]
    [DynamicResourceKey(
        LocaleKey.ProxySettings_UseAuthentication_Header,
        LocaleKey.ProxySettings_UseAuthentication_Description)]
    [SettingsItem(IsVisibleBindingPath = nameof(IsEnabled))]
    public partial bool UseAuthentication { get; set; }

    [ObservableProperty]
    [DynamicResourceKey(
        LocaleKey.ProxySettings_Username_Header,
        LocaleKey.ProxySettings_Username_Description)]
    [SettingsItem(IsVisibleBindingPath = $"{nameof(IsEnabled)} && {nameof(UseAuthentication)}")]
    public partial string? Username { get; set; }

    [ObservableProperty]
    [DynamicResourceKey(
        LocaleKey.ProxySettings_Password_Header,
        LocaleKey.ProxySettings_Password_Description)]
    [SettingsItem(IsVisibleBindingPath = $"{nameof(IsEnabled)} && {nameof(UseAuthentication)}")]
    [SettingsStringItem(IsPassword = true)]
    public partial string? Password { get; set; }
}